<?php

/**
 * 基础Controller
 */

namespace app\modules\admin\controllers;

use Yii;
use yii\web\Controller;
use yii\web\ForbiddenHttpException;

class AdminController extends Controller {

    public function __construct($id, $module) {
        parent::__construct($id, $module);
        $this->layout = 'main.php';
        if (Yii::$app->user->isGuest) {
            return $this->redirect('/user/login');
        } elseif (Yii::$app->user->identity->rid != 1) {
            $session = Yii::$app->session;
            throw new ForbiddenHttpException;
        }
    }

}
